﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using LunarPhase.Gadget.ViewModel;
using Moq;
using System.Globalization;
using LunarPhase.Model;

namespace LunarPhase.Test
{
    [TestClass()]
    public class LunarWindowViewModelTest
    {
        [TestMethod()]
        [Ignore()]
        public void MoonImageMustBeEqualToAbsoluteMoonAge()
        {
            var aMoon = new Mock<Moon>();
            for (int i = 1; i < 30; i++)
            {
                aMoon.Setup(moon => moon.MoonAge).Returns(i);
                LunarWindowViewModel lw = new LunarWindowViewModel(aMoon.Object);
                Uri expected = new Uri(string.Format("../Images/Moon{0}.png", i.ToString()), UriKind.RelativeOrAbsolute);
                Assert.AreEqual<Uri>(expected, lw.CurrentMoonImage);
            }
        }

        [TestMethod()]
        [Ignore()]
        public void WhenMoonAgeIsZeroImageMustBeMoon1()
        {
            var aMoon = new Mock<Moon>();
            aMoon.Setup(moon => moon.MoonAge).Returns(0);
            LunarWindowViewModel lw = new LunarWindowViewModel(aMoon.Object);
            Uri expected = new Uri(string.Format("../Images/Moon{0}.png", 1), UriKind.RelativeOrAbsolute);
            Assert.AreEqual<Uri>(expected, lw.CurrentMoonImage);
        }


        [TestMethod()]
        [Ignore()]
        public void WhenMoonPercentageIlluminatedIs0LightMustBeZeroPerc()
        {
            var aMoon = new Mock<Moon>();
            aMoon.Setup(moon => moon.PercentageIlluminated).Returns(0);
            string expected = string.Concat("0", CultureInfo.CurrentCulture.NumberFormat.PercentSymbol);
            LunarWindowViewModel lw = new LunarWindowViewModel(aMoon.Object);
            Assert.AreEqual<string>(expected, lw.PercLight);
        }

        [TestMethod()]
        [Ignore()]
        public void WhenMoonPercentageIlluminatedIs100LightMustBe100Perc()
        {
            var aMoon = new Mock<Moon>();
            aMoon.Setup(moon => moon.PercentageIlluminated).Returns(100);
            string expected = string.Concat("100", CultureInfo.CurrentCulture.NumberFormat.PercentSymbol);
            LunarWindowViewModel lw = new LunarWindowViewModel(aMoon.Object);
            Assert.AreEqual<string>(expected, lw.PercLight);
        }
    }
}
